
global datapath "~/DataFolder"
global Analyses "~/Results"

***************************************************** Table 10: Loan Performance

use "$datapath/RegData.dta", clear

gen str5 county_fips = string(fips,"%05.0f")

merge 1:1 rssdhcr county_fips year using "$datapath/LoanPerformance.dta"
keep if _merge ==3
drop _merge

global controls credit ltv dti itrate avgloan_income avgmale avgminority branch distance numsbl lretain size loan deposit p_ci p_re roa liquid

winsor2 d60 d90 foreclosure credit ltv dti itrate avgloan_income avgmale avgminority, cut(2.5 97.5) by(year) replace

reghdfe d60 spec_above5pctemp $controls , absorb(county_year bank_state) cluster(fips)
outreg2 using Table10.xls, replace label dec(3) drop(num) nor2 stats(coef se) addstat(Adjusted R-squared,e(r2_a)) addtext(County*Year FE, Yes, Bank*State FE, Yes) 

reghdfe d90 spec_above5pctemp $controls , absorb(county_year bank_state) cluster(fips)
outreg2 using Table10.xls, append label dec(3) drop(num) nor2 stats(coef se) addstat(Adjusted R-squared,e(r2_a)) addtext(County*Year FE, Yes, Bank*State FE, Yes) 

reghdfe foreclosure spec_above5pctemp $controls , absorb(county_year bank_state) cluster(fips)
outreg2 using Table10.xls, append label dec(3) drop(num) nor2 stats(coef se) addstat(Adjusted R-squared,e(r2_a)) addtext(County*Year FE, Yes, Bank*State FE, Yes) 


